<template>
    <el-select v-model="sys_code_value" placeholder="请选择" @change="selectChange">
        <el-option v-for="item in options" :key="item.sys_code" :label="item.sys_code_name" :value="item.sys_code">
        </el-option>
    </el-select>
</template>
  
<script lang="ts" setup>
import * as Request from "../../general/request";
import {  ref } from 'vue';
import { ElMessage } from "element-plus";

const options: Array<any> = []
const sys_code_value = ref("")
const sys_code_type = ref("")

const selectChange = (e: any) => {
    sys_code_value.value = e
}

const sys_code_get = async (sys_code_type: string) => {
    const response = await Request.GET("/background/home/sys_code", {
        sys_code_type: sys_code_type,
    });
    if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
            options.value = return_data.data;
            // this.$message.success(return_data.msg)
        } else {
            ElMessage.error(return_data.msg);
        }
    }
}

defineExpose({
    sys_code_value,
    options,
    sys_code_get
})

</script>
  
<style scoped>

</style>
  